<?php
// +----------------------------------------------------------------------
// | 产品渠道限购配置
// +----------------------------------------------------------------------
// | Author: TongBC <501468940@qq.com>
// +----------------------------------------------------------------------
// | Date  : 2015/06/05
// +----------------------------------------------------------------------
if(isset($_REQUEST['lists']) && $_REQUEST['lists']=='get'){
	include_once '/var/www/html/new/com.inc.php';
	$sid = $_SESSION['sid'];
	$ctn = array('total'=>0, 'list'=>array());
	$sql = "select r.id as rid,p.p_name,r.daily_buy_limit,r.buy_interval,r.buy_num_limit,r.dstatus,p.id as pid from pft_p_apply_evolute e inner join uu_products p on p.id=e.pid left join pft_prod_restrict r on p.id=r.pid ";
	$sql.= "where e.fid=$sid and p.apply_limit=1 and p.p_status in(0,2,3,4,5) and e.status=0 and e.sourceid<>$sid";
	// echo $sql;
	// exit;
	$GLOBALS['le']->query($sql);
	while($row=$GLOBALS['le']->fetch_assoc()) $ctn['list'][$row['pid']] = $row;
	$ctn['total'] = count($ctn['list']);
	exit(json_encode($ctn));
}





include_once '/var/www/html/new/d/common/header.html';
//include_once '/var/www/html/new/d/common/header_top_q.html';
include_once '/var/www/html/new/d/common/left.html';
include_once '/var/www/html/new/d/common/func.inc.php'; 
include_once '/var/www/html/new/d/class/abc/Member.class.php';
include_once '/var/www/html/new/d/class/abc/Product.class.php';


$ac=$GLOBALS['_ac']; 
$pw=$GLOBALS['_pw']; 
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));

// 获取已经配置的记录
$var = array(); 
$sql = "select r.id,p.p_name,r.daily_buy_limit,r.buy_interval,r.buy_num_limit,r.dstatus from pft_prod_restrict r left join uu_products p on p.p_name=r.pid";
$GLOBALS['le']->query($sql);
while($row=$GLOBALS['le']->fetch_assoc()){
	$var['rlist'][] = $row;
}
include('/var/www/html/new/d/tpl/prod_restrict.html');
include('/var/www/html/new/d/common/footer.html');
?>